@extends('layout.admin')

@section('title')
<title>商品列表</title>
@endsection

@section('content')
<style>
#search{
    margin-top:10px;
	width:70px;
	height:30px;
}
#fox{
	margin-left:115px;
}
#fox input[type='text']{
	border-radius: 30px;
}
#fox button{
	border:0px;
	border-radius:100px;
}
</style>
	<form action="/goods">
     <div class="col-md-4" style="padding-left:0px">
	    <select name="num" id="search">
			<option value="5" @if($request->num == 5) selected @endif >5</option>		
			<option value="10" @if($request->num == 10) selected @endif >10</option>		
			<option value="20" @if($request->num == 20) selected @endif >20</option>		
			<option value="30" @if($request->num == 30) selected @endif >30</option>		
			<option value="40" @if($request->num == 40) selected @endif >40</option>		
	    </select>
	    <button type="submit" class="btn btn-default" style="background:#ECEDF0;border:0px"><i class="fa fa-search" ></i></button>
     </div> 

     </form>
	<form action="/goods" class="navbar-form navbar-left" role="search" id="fox">
		  <div class="form-group">
		    <input type="text" class="form-control" name="title" value="{{$request->title}}" placeholder="商品名称">
		  </div>
		  <div class="form-group">
		    <input type="text" name="size" value="{{$request->size}}" class="form-control" placeholder="尺寸">
		  </div>
		  <div class="form-group">
		    <input type="text" name="color" value="{{$request->color}}" class="form-control" placeholder="颜色">
		  </div>
		  <button type="submit" class="btn btn-default" style="background:#ECEDF0"><i class="fa fa-search" ></i></button>
	</form>
  <div class="row"> 
   <div class="col-lg-12">

    <div class="panel"> 
      @if(count($errors)>0)
      <div class="alert alert-danger">
        出错啦哦!!!
        @foreach($errors->all() as $error)
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>{{$error}}</strong>
        @endforeach
      </div>
      @endif
     <div class="panel-heading bk-bg-primary"> 
      <h6><i class="fa fa-table red"></i><span class="break">商品列表</span></h6> 
      <div class="panel-actions"> 
       <a class="btn-setting" href="#"><i class="fa fa-rotate-right"></i></a> 
       <a class="btn-minimize" href="#"><i class="fa fa-chevron-down"></i></a> 
       <!-- <a class="btn-close" href="#"><i class="fa fa-times"></i></a>  -->
      </div> 
     </div>

     <div class="panel-body"> 
      <div class="table-responsive"> 
       <table class="table table-striped table-bordered table-hover bootstrap-datatable datatable"> 
        <thead> 
         <tr> 
          <th class="center">ID</th> 
          <th class="center">商品名称</th> 
          <th class="center">价格</th> 
          <th class="center">原价</th> 
          <th class="center">尺寸</th> 
          <th class="center">颜色</th> 
          <th class="center">库存</th> 
          <!-- <th class="center">商品图片</th>  -->
          <th class="center">商品详情</th> 
          <th class="center">操作</th> 
         </tr> 
        </thead> 
        <tbody> 
        @foreach($goods as $k=>$v)
         <tr> 
          <td class="center">{{$v['id']}}</td> 
          <td class="center">{{$v['title']}}</td> 
          <td class="center">{{$v['price']}}</td> 
          <td class="center">{{$v['oldprice']}}</td> 
          <td class="center">{{$v['size']}}</td> 
          <td class="center">{{$v['color']}}</td> 
          <td class="center">{{$v['kucun']}}</td> 
          <!-- <td class="center"><img style="width:50px;height:50px" src="{{$v['src']}}" class="img-circle"></td>  -->
          <td class="center">{{$v['detail']}}</td> 
          <td class="hidden-480" style="width:85px">
          <a href="/goods/{{$v->id}}/edit" class="btn btn-info btn-sm pull-left" style="margin-right:10px"><i class="fa fa-edit"></i></a> 
          <form action="/goods/{{$v->id}}" method="post">
			<input type="hidden" name="_method" value="delete">
			{{csrf_field()}}
			 <button class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i></button>
          </form>
          </td> 
         </tr> 
		@endforeach	
        </tbody> 
       </table>
       <div id="pages">
       {!!$goods->appends($request->all())->render()!!}
	   </div> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div>
  <style>
	#pages{
		float:right;
	}
  </style>

@endsection